#pragma once
#ifndef SALES_DATA_H
#define SALES_DATA_H
#include <string>
class Sales_data {
	friend Sales_data add(const Sales_data&, const Sales_data&);
	friend std::ostream &Sale_print(std::ostream&, const Sales_data&);
	friend std::istream &read(std::istream&, Sales_data&);

public:
	Sales_data() = default;
	Sales_data(const std::string &s) :bookNo(s) { std::cout << "Delegating Constructor.2" << std::endl; }
	Sales_data(const std::string &s, unsigned n, double p) :bookNo(s), units_sold(n), revenue(p*n) {}
	Sales_data(std::istream &);
	Sales_data(const std::string s, std::int32_t i) :Sales_data(s) { std::cout << "Delegating Constructor 1." << std::endl; }


	std::string isbn() const { return bookNo; }
	Sales_data& combine(const Sales_data&);

	static void rate(double);
private:
	static double interestRate;
	double avg_price() const;
	std::string bookNo;
	unsigned units_sold = 0;
	double revenue = 0.0;
};
Sales_data add(const Sales_data&, const Sales_data&);
Sales_data add(const Sales_data&, const Sales_data&);
std::ostream &Sale_print(std::ostream&, const Sales_data&);
std::istream &read(std::istream &, Sales_data&);
#endif // !SALES_DATA_H
